﻿//=====================================================================================================
// LocalizationLibrary
// The Localization Library is a collection of reusable software component that provide 
// support for localization. This library enable you to localize WPF, Silverlight and WP7 applications.
// (http://localizationlibrary.codeplex.com)
//=====================================================================================================
// Author: Nicola Gallo (Website: www.nicola.gallo.name, Email: nicolagmt@hotmail.it) 
//=====================================================================================================

namespace HelloWorld.Silverlight.Web.Services
{
    //.NET References
    using System;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.Activation;

    [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class LocalizationService
    {
        //Methods

        /// <summary>
        /// Gets the localized resource value of the resource that has ResourceID equals to <paramref name="resourceID"/>.
        /// </summary>
        /// <param name="resourceID">Resource identifier.</param>
        /// <param name="langCode">Language code.</param>
        /// <returns>The localized resource value of the resource that has ResourceID equals to <paramref name="resourceID"/>.</returns>
        [OperationContract]
        public string GetResourceValue(String resourceID, String langCode)
        {
            String retVal = null;
            if ((!String.IsNullOrWhiteSpace(resourceID)) && (!String.IsNullOrWhiteSpace(langCode)))
            {
                retVal = ResourceManager.GetResourceValue(resourceID, langCode);
            }
            return retVal;
        }
    }
}
